home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
AOL File Library: 4,401 to 4,500
/
aol-file-protocol-4400-4401-to-4500.zip
/
AOLDLs
/
PDA-Newton Development
/
Newt 3.4 (develop apps,pkgs).sit
/
newt-devenv-34.sit
/
graphic0.nwt
< prev
next >
Wrap
Text File
|
1998-01-25
|
3KB
|
126 lines
Notes
{labels: 'NIL, viewFont: 10241} // nil=Unfiled, or specify a folder, e.g., 'Business. remove viewFont for current Styles default
//ERASE! in order to erase existing entries in this folder first
graphic0.nwt -- Sloup format
25 Jan 1998
Copyright 1994-98 S. Weyer. All Rights Reserved Worldwide.
To be distributed only with NewtDevEnv
introductory Newt graphics examples
sources for: poly, poly2, polyspi, squiral, cCurve, house, rect
see graphic1.nwt for: squiral2 (interruptible version), dCurve,
fractal, hilbert, fourNewts (multiple Newts), tree
see NewtTurT -- interactive tutorial for more description
To minimize text entry, use the Sloup utility and a terminal emulator to
transfer this text file as paragraphs in the Notepad. The folder in 2nd line
is currently set on nil (Unfiled); select same folder in Newt to load.
----------
poly2
//:poly2 (5,80,360/5,0)
//:poly2 (5,80,180-180/5,0)
//:poly2 (times,dist,deg,90)
func(nsides,len,ang,ang2)
// poly with an extra turn at end for squiral & squiral2
// also, ang precomputed & passed
// assumes nsides already checked
begin
local i;
for i:=1 to nsides
do begin
:go(len);
:turn(ang);
end;
:turn(ang2);
end
----------
poly
//:poly (4,100)
//:poly (times,dist)
//local i; for i:=3 to times do :poly(i,dist)
//:poly(Random(3,15),Random(10,20))
func (nsides,len)
if nsides>0
then :poly2(nsides, len, 360/nsides, 0)
else :beep()
----------
squiral
//:squiral (10,75)
//:squiral (times,dist)
//:addNewt('[[newt1,-55,75,1],[newt2,55,75,2],[newt3,55,-75,1],[newt4,-55,-75,2]],nil,nil,nil)
//newt1:poly2(5,40,144,0)
//:squiral (8,40)
//:cCurve (6,4,0)
func (num,len)
// draw <num> squares
// each of size <len>
// after each, turn 360/num
if num>0
then begin
local i, ang2:=360/num;
for i:=1 to num
do :poly2 (4,len,90,ang2);
end
else :beep()
----------
cCurve
//:cCurve (6,8,0)
//:cCurve (8,4,0)
//:cCurve (times,dist,deg)
func(num,dist,deg)
if num>0 // warning num>8 could take awhile...
then begin // the double-recursion (not a simple "tail recursion")
:cCurve(num-1, dist, deg+45);
:cCurve(num-1, dist, deg-45);
end
else begin // where the actual drawing occurs
:turnTo(deg);
:go(dist);
end
----------
polyspi
//:polyspi (100,10,89)
//:polyspi (times,dist,deg)
func(num,size,angle)
begin
local i;
for i:=1 to num
do begin
:go(size);
:turn(angle);
size := size+1;
end;
end
----------
house
//:house (dist)
func(size)
begin
local dht := size/4, dwid := size/8;
local wsize := dwid;
:poly(4,size);
:turn(90); :go(dht); :turn(-90);
:rect(dht,dwid); // door
:move(3*dht);
:poly(4,wsize); // window
:turn(90); :move(size/2); :turn(-90);
:poly(4,wsize); // window
end
----------
rect
func(side1,side2)
begin
local i;
for i:=1 to 2
do begin
:go(side1); :turn(90);
:go(side2); :turn(90);
end;
end
----------
BYE!